package models

import "gorm.io/gorm"

type User struct {
	gorm.Model
	Phone    string `gorm:"type:varchar(60);not null; commit:'账号'"`
	Password string `gorm:"type:char(32);not null; commit:'密码'"`
}
type IdCardAuth struct {
	gorm.Model
	Realname string `gorm:"type:varchar(60);not null; commit:'真实姓名'"`
	IdCard   string `gorm:"type:char(18);not null; commit:'身份证'"`
	UserId   int    `gorm:"type:int;not null; commit:'用户Id'"`
}

func (u *IdCardAuth) Create() error {
	return DB.Create(&u).Error
}

func (u *IdCardAuth) GetAuthByUserId() error {
	return DB.Where("user_id=?", u.UserId).Limit(1).Find(&u).Error
}
